#define _CRT_SECURE_NO_WARNINGS 1 
#include "list.h"

template<class T>
void print(const cgc::list<T>& lt)
{
	typename cgc::list<T>::const_iterator it = lt.begin();
	while (it != lt.end())
	{
		cout << *it << " ";
		it++;
	}
	cout << endl;
}

void test1()
{
	cgc::list<int> l1;
	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_front(6);
	print(l1);
	l1.pop_back();
	l1.pop_front();
	print(l1);
	l1.clear();
	print(l1);
}

void test2()
{
	cgc::list<int> l1;
	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_front(6);
	print(l1);
	auto it = l1.erase(l1.begin());
	print(l1);
	cout << *it << endl;
	l1.clear();
	print(l1);
}

void test3()
{
	cgc::list<int> lt1 = { 1,2,3,4,5,6,7 };
	auto lt2 = lt1;
	print(lt2);
}

struct Pos
{
	int _row;
	int _col;

	Pos(int row = 0, int col = 0)
		:_row(row)
		, _col(col)
	{}
};

void test4()
{

}

int main()
{
	cgc::list<int> l1;
	l1.push_back(1);
	l1.push_back(2);
	l1.push_back(3);
	l1.push_front(6);
	print(l1);

	cgc::list<int>::reverse_iterator r_it = l1.rbegin();
	while (r_it != l1.rend())
	{
		cout << *r_it << " ";
		++r_it;
	}
	cout << endl;

	return 0;
}